/*路由使用步骤*/

// 1.引入对应的模块
import Vue from 'vue'
import Router from 'vue-router'

// 2.在Vue中声明使用Router
Vue.use(Router)

// 3.输出路由对象，方便其他模块使用
export default new Router({
  // 在路由映射表中配置一级路由
  routes: [
    {
      path: '/home',
      component: ()=>import('../views/Home/Home'),
      children:[
        // 二级路由不需要加 / 系统默认这样拼接 /一级路由/二级路由
        {path:'hot',component:()=>import('../views/Home/Children/Hot/Hot'),meta: {TabBar:true}},
        {path:'box',component:()=>import('../views/Home/Children/Box')},
        {path:'dress',component:()=>import('../views/Home/Children/Dress')},
        {path:'ele',component:()=>import('../views/Home/Children/Ele')},
        {path:'food',component:()=>import('../views/Home/Children/Food')},
        {path:'general',component:()=>import('../views/Home/Children/General')},
        {path:'man',component:()=>import('../views/Home/Children/Man')},
        {path:'mbaby',component:()=>import('../views/Home/Children/Mbaby')},
        {path:'shirt',component:()=>import('../views/Home/Children/Shirt')},
        {path:'/home',redirect:'/home/hot'},
      ]
    },
    {
      path: '/recommend',
      component: ()=>import('../views/Recommend/Recommend'),
      meta: {TabBar:true}
    },
    {
      path: '/search',
      component: ()=>import('../views/Search/Search'),
      meta: {TabBar:true}
    },
    {
      path: '/chat',
      component: ()=>import('../views/Chat/Chat'),
      meta: {TabBar:true}
    },
    {
      path: '/mine',
      component: ()=>import('../views/Mine/Mine'),
      meta: {TabBar:true}
    },
    {
      path: '/login',
      component: ()=>import('../views/Login/Login')
    },
    {
      path: '/setting',
      component: ()=>import('../views/Mine/MeSetting')
    },
    {
      path: '/detail',
      component: ()=>import('../views/Mine/MeDetail')
    },
    {
      path: '/',
      redirect:'/home'
    }
    // 后续添加错误路径404路由
  ]
})
